import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
	path: '/',
	name: 'main',
	redirect: '/home',
	component: () => import('../views/Main.vue'),
	children: [
		//首页
		{
			path: '/home',
			name: 'home',
			component: () => import('../views/Home.vue')
		},
		//分类
		{
			path: '/classify',
			name: 'classify',
			component: () => import('../views/Classify.vue')
		},
		//购物车
		{
			path: '/cart',
			name: 'cart',
			component: () => import('../views/Cart.vue')
		},
		//用户
		{
			path: '/user',
			name: 'user',
			component: () => import('../views/User.vue')
		}
	]
},
//登录
{
	path: '/login',
	name: 'login',
	component: () => import('../views/Login.vue')
},
//注册
{
	path: '/register',
	name: 'register',
	component: () => import('../views/Register.vue')
},
//忘记密码
{
	path: '/forget',
	name: 'forget',
	component: () => import('../views/Forget.vue')
},
//砍价列表
{
	path: '/goodslist',
	name: 'goodslist',
	component: () => import('../views/GoodsList.vue')
},
//商品详情
{
	path: '/details',
	name: 'details',
	component: () => import('../views/GoodsDetails.vue')
},
//文章详情
{
	path: '/articledetails',
	name: 'articledetails',
	component: () => import('../views/ArticleDetails.vue')
}
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
